package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.TreeHoleReportsMapper;
import com.hello.system.domain.TreeHoleReports;
import com.hello.system.service.ITreeHoleReportsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 树洞举报Service业务层处理
 * 
 * @author hello
 * @date 2025-05-28
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class TreeHoleReportsServiceImpl extends ServiceImpl<TreeHoleReportsMapper, TreeHoleReports> implements ITreeHoleReportsService 
{
    private final TreeHoleReportsMapper treeHoleReportsMapper;

    /**
     * 查询树洞举报
     * 
     * @param reportId 树洞举报主键
     * @return 树洞举报
     */
    @Override
    public TreeHoleReports selectTreeHoleReportsByReportId(Long reportId)
    {
        return treeHoleReportsMapper.selectTreeHoleReportsByReportId(reportId);
    }

    /**
     * 查询树洞举报列表
     * 
     * @param treeHoleReports 树洞举报
     * @return 树洞举报
     */
    @Override
    public List<TreeHoleReports> selectTreeHoleReportsList(TreeHoleReports treeHoleReports)
    {
        return treeHoleReportsMapper.selectTreeHoleReportsList(treeHoleReports);
    }

    /**
     * 新增树洞举报
     * 
     * @param treeHoleReports 树洞举报
     * @return 结果
     */
    @Override
    public int insertTreeHoleReports(TreeHoleReports treeHoleReports)
    {
        treeHoleReports.setCreateTime(DateUtils.getNowDate());
        return treeHoleReportsMapper.insertTreeHoleReports(treeHoleReports);
    }

    /**
     * 修改树洞举报
     * 
     * @param treeHoleReports 树洞举报
     * @return 结果
     */
    @Override
    public int updateTreeHoleReports(TreeHoleReports treeHoleReports)
    {
        treeHoleReports.setUpdateTime(DateUtils.getNowDate());
        return treeHoleReportsMapper.updateTreeHoleReports(treeHoleReports);
    }


    /**
     * 批量删除树洞举报
     * 
     * @param reportIds 需要删除的树洞举报主键
     * @return 结果
     */
    @Override
    public int deleteTreeHoleReportsByReportIds(Long[] reportIds)
    {
        return treeHoleReportsMapper.deleteTreeHoleReportsByReportIds(reportIds);
    }

    /**
     * 删除树洞举报信息
     * 
     * @param reportId 树洞举报主键
     * @return 结果
     */
    @Override
    public int deleteTreeHoleReportsByReportId(Long reportId)
    {
        return treeHoleReportsMapper.deleteTreeHoleReportsByReportId(reportId);
    }

    /**
     * 统计指定树洞内容的举报次数
     * 
     * @param treeHoleId 树洞内容ID
     * @return 举报次数
     */
    @Override
    public int countReportsByTreeHoleId(Long treeHoleId)
    {
        return treeHoleReportsMapper.countReportsByTreeHoleId(treeHoleId);
    }
}
